<?php
/**
 * @package Sj Mega News
 * @version 2.5
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @copyright (c) 2012 YouTech Company. All Rights Reserved.
 * @author YouTech Company http://www.smartaddons.com
 * 
 */
defined('_JEXEC') or die;

ob_start();
	include JModuleHelper::getLayoutPath($module->module,'styles');
	$stylesheet=ob_get_contents();
	ob_end_clean();
	$docs=JFactory::getDocument();
	$docs->addStyleDeclaration($stylesheet); 
?>
<?php if(!empty($list)){?>
    <div id="yt-mega-news_<?php echo $module->id;?>" class="yt_mega_news">	
     <div class="intro_text" style="width:<?php echo $params->get('width_module');?>px"><?php echo $params->get('intro_text'); ?></div>
        <div id="ytc_tabs<?php echo $module->id;?>" class="theme3">
		<?php    	      					
		if(!empty($list)){	$i=1;	$counttotal = count($list);  
		foreach ($list as $key=>$value) {   
		$firstval = current ($value);  
		 
		 if ($i==1) {
		 ?>
		  <div style="max-width: <?php echo $params->get('width_module');?>px; width: <?php echo $params->get('width_module');?>px; float:left; margin-bottom: 20px"> <?php }?>
		   <div class="content_box" style="max-width: <?php echo ($params->get('width_module')/ $params->get('numcols'));?>px; width: <?php echo $params->get('width_module')/ $params->get('numcols');?>px; "> 			
			 	<div class="tabs" >			   
					<div class="category_title_left">&nbsp;</div>
					<div class="category_title_center">
					<div class="category_name">
					<a href="<?php echo $firstval['category_link'];;?>" target="<?php echo $params->get('target');?>">
					<?php echo $firstval['category_sub_title']; ?>
					</a>
					</div>
					</div> 
					<div class="category_title_right">&nbsp;&nbsp;&nbsp; </div>
			    </div> <!--end tabs-->
                <div class="box-wrapper">     
                <?php 
                      $j=1;                    
                  //  $firstVal = current($item); 
                ?>
                    <div class="content-box <?php if($j==1) echo "current";?>" style="max-width: <?php echo (($params->get('width_module')/ $params->get('numcols')) -10);?>px; width: <?php echo (($params->get('width_module')/ $params->get('numcols')) -10);?>px; ">
					 <div class="inner_content" style="max-width: <?php echo ($params->get('width_module')/ $params->get('numcols'));?>px; width: <?php echo ($params->get('width_module')/ $params->get('numcols'));?>px; overflow: hidden ">                     
                      <?php 	$ij=1;	$counttotal_item = count($value);     					
					 foreach ($value as $key1=>$value1) {		
				     if($ij==1){?> 		
					 <div class="normal-content"><?php }?>	
					  <div class="content" style="max-width: <?php echo ((($params->get('width_module')/ $params->get('numcols'))/ $params->get('num_items'))-10);?>px; width: <?php echo ((($params->get('width_module')/ $params->get('numcols'))/ $params->get('num_items'))-10);?>px;">
						 <div class="article" style="overflow: hidden; margin-right: 10px; max-width: <?php echo ((($params->get('width_module')/ $params->get('numcols'))/ $params->get('num_items'))-20);?>px; width: <?php echo ((($params->get('width_module')/ $params->get('numcols'))/ $params->get('num_items'))-20);?>px;">   
							<?php if($params->get('show_title_article') ==1){?>
							<div class="article_title">                              
							<?php if($params->get('link_title_article') == 1) {?>
							<a style="color:<?php echo $params->get('title_article_color');?>;" href="<?php echo $value1['article_link'];?>" target="<?php echo $params->get('target');?>">                
							<?php echo $value1['article_sub_title'];?>                
							</a>                     
							<?php }
							else 
							{
							echo $value1['article_sub_title'];  
							}                         
							?>
							</div> 
							<?php } ?>         
					   
							<div class="col-two col" style="overflow: hidden; max-width: <?php echo ((($params->get('width_module')/ $params->get('numcols'))/ $params->get('num_items'))-20);?>px; width: <?php echo ((($params->get('width_module')/ $params->get('numcols'))/ $params->get('num_items'))-20);?>px;">  
								<?php if (($params->get('show_image') == 1) && ($value1['article_image']!='')){ ?>
								<div class="image" style="width: <?php echo $params->get('item_thumbnail_width');?>px; height: <?php echo $params->get('item_thumbnail_height');?>px"> 
								<?php                                     
								
								 if($params->get('link_image') ==1) {?>
								
								<a href="<?php echo $value1['article_link'];?>" target="<?php echo $params->get('target');?>">
								<img src="<?php echo $value1['article_image']?>" alt="<?php echo $firstval['article_sub_title'];?>" width=" <?php echo $params->get('item_thumbnail_width');?>px;" height=" <?php echo $params->get('item_thumbnail_height');?>px;" />
								</a>
								
								<?php  } 
								else 
								{?>
								<img src="<?php echo $value1['article_image']?>" alt="<?php echo $firstval['article_sub_title'];?>" width=" <?php echo $params->get('item_thumbnail_width');?>px;" height=" <?php echo $params->get('item_thumbnail_height');?>px;" />
								<?php } ?>
								</div><!--end image-->
							 	<?php } ?>
								
							    <div class="sub-content" >	
									<?php if ($params->get('show_description') == 1){  ?>
									<div class="sub_content">
									<?php   echo $value1['article_content']?>
									</div><!--end sub_content-->
									<?php } ?>
								
									<?php if ($params->get('show_read_more_link') == 1) {?>   
									<div class="read_more">
									<a href="<?php echo $value1['article_link'];?>" target="<?php echo $params->get('target');?>"><?php echo $params->get('read_more_text');?></a>
									</div>
									<?php }?>
								</div>
							</div> 
						  </div><!--end article-->
					    </div> <!-- end content-->
						   <?php if(($counttotal_item) == $ij){ //Ytools::dump($ij);die();  ?>
                             </div><?php } else {?>
                            <?php if($ij%$params->get('num_items')==0) {?> </div><div class="normal-content" style="max-width:<?php echo ($params->get('width_module')/ $params->get('numcols'));?> px; width: <?php echo ($params->get('width_module')/ $params->get('numcols'));?>px; "> <?php }?>
                            <?php }?>                             
                            <?php $ij++; } ?>  
                           </div>  <!--end inner-content-->  		
					        <?php if ($params->get('show_all_articles') ==1) { ?>                              
                            <div class="link_category"> 
                            <div class="arrow1"> &nbsp;</div>                               
                                <a href="<?php echo $firstval['category_link'];?>" target="<?php echo $params->get('target');?>">
                                <?php echo $params->get('view_all_text');?>
                                </a>
                                              
                            </div>
                            <?php }?>        
					
				 </div> <!--end content-box-->  							
			     </div> <!-- END Box Wrapper -->			  
				 </div> <!--end box-->  	
				 <?php if(($counttotal) == $i){?>
				 </div><?php } else {?>
				 <?php if($i%$params->get('numcols') ==0) {?> </div><div style="max-width: <?php echo $params->get('width_module');?>px; width: <?php echo $params->get('width_module');?>px; float:left; margin-bottom: 20px"> <?php }?>
				 <?php }?>                             
				 <?php $j++; $i++;}} ?>                              
                          
			</div><!--end theme3--> 
		
       <div class="footer_text" style="width:<?php echo $params->get('width_module');?>px"><?php echo $params->get('footer_text'); ?></div>
    </div>   
  <?php } else { echo JText::_('Has no content to show!');}?>